/**   
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-11-24 22:42:12  
 * Copyright (c) 2015- joysuch-版权所有     
 */

package com.joysuch.wwyt.risk.controller;

import java.util.List;

import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.risk.bean.RiskEvaluationMethodItemBean;
import com.joysuch.wwyt.risk.service.RiskEvaluationMethodItemService;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "双预防-风险评估方法")
@RequestMapping("/risk/evaluation-method-item")
public class RiskEvaluationMethodItemController {

    private static final Logger logger = LoggerFactory.getLogger(RiskEvaluationMethodItemController.class);

    @Autowired
    private RiskEvaluationMethodItemService riskEvaluationMethodItemService;

    @RequestMapping("get-by-subfactor")
    public Object get(String method, String key) {
        try {
            List<RiskEvaluationMethodItemBean> list = riskEvaluationMethodItemService.findItems(method, key);
            return ResultBean.success(list);
        } catch (Exception e) {
            logger.error("创建失败", e);
            return ResultBean.fail(101, "创建失败");
        }
    }

    @RequestMapping("get-by-factor")
    public Object getByFactor(String method, String key) {
        try {
            List<RiskEvaluationMethodItemBean> list = riskEvaluationMethodItemService.findItemsByFactor(method, key);
            return ResultBean.success(list);
        } catch (Exception e) {
            logger.error("创建失败", e);
            return ResultBean.fail(101, "创建失败");
        }
    }

}
